<link href="/public/admin/css/toutiao.css" rel="stylesheet">
<script src="/public/common/ajaxfileupload.js"></script>
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div style=" display: none;" class="photolist">
            <h2>图片资源管理器</h2>
            <img onclick="$('.photolist').hide(200);" class="closed" src="/public/admin/img/guanbi.png"/>

            <div data-type="0" class="content jq_photolist">
                <div class="addimg">
                    <img onclick="$('#file').click();" src="/public/admin/img/add_img.png"/>
                    <input type="file" name="file" id="file" style="display:none;"/>
                    <div style=" margin-top: 10px; text-align: center;font-size: 14px; ">添加新图片</div>
                </div>

            </div>
        </div>
        <div class="toutiaolt">
            <form action="<?=url('tongcheng.toutiao/create2');?>" id="toutiao_form">
                <div class="title">
                    <h2>
                        <a id="jq_title" href="javascript:void(0);">设置标题</a>
                        <input type="hidden" name="title" id="title" value=""/>
                        <input type="hidden" name="nav_id" id="nav_id" value=""/>
                        <input type="hidden" name="author" id="author" value=""/>
                    </h2>
                    <div class="imglist">
                        <div id="show_pic1" class="imgadd">
                            <img src="/public/admin/img/add_img.png"/>
                            <input type="hidden" name="photo1" id="photo1"/>
                        </div>
                    </div>
                </div>
                <div class="duanluo">
                </div>
                <div class="button">
                    <button type="button" class="jq_dl_add btn btn-outline btn-default">新增段落</button>
                    <button mini="submit" for="toutiao_form" type="button" class="btn btn-outline btn-primary">发布文章
                    </button>
                    <button type="button" class="jq_yl_show btn btn-outline btn-info">预览</button>
                </div>
            </form>
        </div>
        <div class="toutiaort">
            <div id="jq_title_setting" class="title_form">

                <div class="col-md-12">
                    <div class="ibox-content">
                        <h2> 设置标题 </h2>
                        <div class="alert alert-info">
                            设置完标题，可以点击左下角添加段落然后添加不同的段落
                        </div>
                        <form role="form" class="form-horizontal m-t">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">标题：</label>
                                <div class="col-sm-9">
                                    <textarea id="titleadd" class="form-control"></textarea>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">分类：</label>
                                <div class="col-sm-9">
                                    <select id="navadd" class="form-control">
                                        <option value="0">请选择</option>
                                        <?php foreach($nav as $val){?>
                                        <option value="<?=$val->nav_id;?>"><?=$val->nav_name;?></option>
                                        <?php }?>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">作者：</label>
                                <div class="col-sm-9">
                                    <input type="text" id="authoradd" class="form-control" placeholder="请输入文本">

                                </div>
                            </div>

                            <button type="button" id="jq_shezhi" class="btn btn-block btn-outline btn-primary">确定设置
                            </button>
                        </form>
                    </div>
                </div>

            </div>

            <div style="display: none;" id="jq_yulang_setting" class="yulang">

            </div>
            <div style="display: none;" id="jq_duanluo_setting" class="title_form">

                <div class="col-md-12">
                    <div class="ibox-content">
                        <h2> 段落管理 </h2>
                        <div class="alert alert-info">
                            段落如果有文章则添加文章，有图片则添加图片，不能两者同时为空！
                        </div>
                        <form role="form" class="form-horizontal m-t">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">文字：</label>
                                <div class="col-sm-9">
                                    <textarea rows="10" id="dlcontent" class="form-control"></textarea>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-3 control-label">图片：</label>
                                <div class="col-sm-9">

                                    <img width="150" height="150" id="dl_show_photo"
                                         src="/public/admin/img/add_img.png"/>
                                    <input type="hidden" name="dlphoto" id="dlphoto"/>
                                </div>
                            </div>
                            <button type="button" id="jq_dlsetting" class="btn btn-block btn-outline btn-primary">确定设置
                            </button>
                        </form>
                    </div>
                </div>

            </div>


        </div>

    </div>
</div>
<script id="imgitemtpl" type="text/html">
    <div class="imgitem">
        <img src="<?php echo IMG_URL;?>{{d.img}}"/>
        <div class="action">
            <button type="button" data-photo="{{d.img}}" class="jq_yes_imgitem btn btn-outline btn-primary">选择</button>
            <button type="button" class="jq_delete_imgitem btn btn-outline btn-danger">删除</button>
        </div>
    </div>
</script>
<script id="yltpl" type="text/html">
    <div class="title">
        {{d.title}}
    </div>
    <div class="author">
        <span>{{d.add_time}}</span>
        <span>{{d.author}}</span>
        <span>阅读0</span>
    </div>
    <div class="content">
        {{# for(var i = 0, len = d.contentdata.length; i < len; i++){ }}
        <div class="dl">
            {{# if(d.contentdata[i].pic){ }}
            <img src="<?php echo IMG_URL;?>{{d.contentdata[i].pic}}"/>
            {{# } }}
            {{# if(d.contentdata[i].content){ }}
            {{d.contentdata[i].content}}
            {{# } }}
        </div>
        {{# } }}
    </div>
</script>
<script id="dlitemtpl" type="text/html">
    <div class="item">
        <a href="javascript:void(0);" class="jq_delete_dl"><img width="30" height="30"
                                                                src="/public/admin/img/delete.png"/></a>
        <div class="jq_item" data-id="{{d.id}}" style="width: 100%;height: 100%;">
            <div class="lt">
                <img id="dl_show_pic_{{d.id}}" width="80" height="80" src="/public/admin/img/wenben.png"/>
            </div>
            <div id="dl_show_content_{{d.id}}" class="rt">

            </div>
            <input type="hidden" name="dl[{{d.id}}][photo]" id="dl_photo_{{d.id}}"/>
            <input type="hidden" name="dl[{{d.id}}][content]" id="dl_content_{{d.id}}"/>
        </div>
    </div>
</script>
<script>
    var day = '<?=date("Y-m-d",time());?>';
    var imgurl = '<?php echo IMG_URL;?>';
    var uploadUrl = '<?=url("upload.upload/index",["mdl"=>"toutiao_photo"])?>';
</script>
<script src="/public/admin/js/toutiao.js"></script>